package planit.view;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;

import javax.swing.AbstractAction;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JSpinner;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.LayoutStyle;
import javax.swing.ListModel;
import javax.swing.SpinnerListModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

import planit.controller.ControllerFactory;
import planit.model.Group;
import planit.model.Model;
import planit.model.Person;
import planit.view.wrappers.GroupWrapper;
import planit.view.wrappers.ModelCellRenderer;
import planit.view.wrappers.PersonWrapper;
import planit.view.EditEventDialog;

import com.toedter.calendar.JDateChooser;

/**
 * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
 * Builder, which is free for non-commercial use. If Jigloo is being used
 * commercially (ie, by a corporation, company or business for any purpose
 * whatever) then you should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details. Use of Jigloo implies
 * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
 * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
 * ANY CORPORATE OR COMMERCIAL PURPOSE.
 */

@SuppressWarnings("serial")
public class MainWindow extends javax.swing.JFrame {

	{
		// Set Look & Feel
		try {
			javax.swing.UIManager
			.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private GroupDialog newGroupDialog;
	private PersonDialog newPersonDialog;
	private EventDialog createNewEventDialog;

	private JMenu deleteMenu;
	private JMenu jMenu4;
	private JMenuItem exitMenuItem;
	private JSeparator jSeparator2;
	private JMenu newFileMenuItem;
	private AbstractAction deleteEventAction;
	private JMenuItem deleteGroupMenuItem;
	private JMenuItem deleteEventMenuItem;
	private JMenuItem deletePersonMenuItem;
	private JDateChooser weekPaneDateChooser;
	private JDateChooser dayPaneDateChooser;
	private AbstractAction addNewEventByDialog;
	private JMenuItem fileMenuItemAddGroup;
	private JMenuItem fileMenuItemAddPerson;
	private JMenuItem fileMenuAddEvent;
	private AbstractAction deletePersonAction;
	private AbstractAction addPersonAction;
	private AbstractAction deleteGroupAction;
	private AbstractAction AddGroupAction;
	private SchedulePaneDay schedulePaneDay;
	private JList personList;
	private JLabel jLabel29;
	private JLabel jLabel28;
	private JLabel jLabel27;
	private JLabel jLabel26;
	private JLabel jLabel25;
	private JLabel jLabel24;
	private JLabel jLabel23;
	private JLabel jLabel22;
	private JLabel jLabel21;
	private JLabel jLabel71;
	private JLabel jLabel70;
	private JLabel jLabel69;
	private JLabel jLabel68;
	private JLabel jLabel67;
	private JLabel jLabel66;
	private JLabel jLabel65;
	private JLabel jLabel64;
	private JLabel jLabel63;
	private JLabel jLabel62;
	private JLabel jLabel61;
	private JLabel jLabel60;
	private JLabel jLabel59;
	private JLabel jLabel58;
	private JLabel jLabel57;
	private JLabel jLabel56;
	private JLabel jLabel55;
	private JLabel jLabel54;
	private JLabel jLabel53;
	private JLabel jLabel52;
	private JLabel jLabel51;
	private JLabel jLabel50;
	private JLabel jLabel49;
	private JLabel jLabel48;
	private JLabel jLabel47;
	private JLabel jLabel46;
	private JLabel jLabel45;
	private JLabel jLabel44;
	private JLabel jLabel43;
	private JLabel jLabel42;
	private JLabel jLabel41;
	private JMenuItem loadMenu;
	private JMenuItem saveMenu;
	private JLabel jLabel40;
	private JLabel jLabel39;
	private JLabel jLabel38;
	private JLabel jLabel37;
	private JLabel jLabel36;
	private JLabel jLabel35;
	private JLabel jLabel34;
	private JLabel jLabel33;
	private JLabel jLabel32;
	private JLabel jLabel31;
	private JLabel jLabel30;
	private JLabel jLabel20;
	private JLabel jLabel19;
	private JLabel jLabel18;
	private JLabel jLabel17;
	private JLabel jLabel16;
	private JLabel jLabel15;
	private JLabel jLabel14;
	private JLabel jLabel13;
	private JLabel jLabel12;
	private JLabel jLabel10;
	private JLabel jLabel9;
	private JLabel jLabel6;
	private JLabel jLabel3;
	private JLabel jLabel2;
	private AbstractAction addPersonToGroupAction;
	private JMenuItem addPersonToGroupMenuItem;
	private AbstractAction editGroupAction;
	private AbstractAction editEventAction;
	
	private JMenuItem addPersonToEventMenu;
	private JMenu addMenu;
	private AbstractAction editPersonAction;
	private EditEventDialog editEventDialog;
	private JMenuItem editPersonMenuItem;
	private JMenuItem editGroupMenuItem;
	private JMenuItem editEventMenuItem;
	private JMenu editMenu;
	private JList groupList;
	private SchedulePaneWeek schedulePaneWeek;
	private JPanel jPanel6;
	private JLabel jLabel11;
	private JComboBox jComboBox4;
	private JLabel jLabel1;
	private JPanel jPanel5;
	private JPanel viewWeek;
	private JPanel groupDisplayPane;
	private JPanel peopleDisplayPane;
	private JSplitPane groupSplit;
	private JPanel groupPeoplePane;
	private JPanel groupPanel;
	private JTabbedPane jTabbedPane1;
	private JPanel jPanel9;
	private JPanel jPanel8;
	private JSpinner jSpinner3;
	private JLabel jLabel5;
	private JComboBox jComboBox2;
	private JLabel jLabel4;
	private JComboBox showWhichPerson;
	private JLabel jLabel8;
	private JPanel jPanel7;
	private JPanel viewMonth;
	private JLabel dayLabel;
	private JComboBox jComboBox1;
	private JLabel jLabel7;
	private JPanel jPanel2;
	private JPanel jPanel3;
	private JPanel viewDay;
	private JTabbedPane scheduleToolTab;
	private JSplitPane scheduleSplitter;
	private JMenu jMenu3;
	private JMenuBar jMenuBar1;
	private AbstractAction exitApplicationAction;


	private Model model;

	/**
	 * Auto-generated main method to display this JFrame
	 */

	public MainWindow(Model model) {
		super();
		this.model = model;
		initGUI();
		updateGroupList();
		updatePersonList();
		// groupList.setSelectedIndex(0);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		this.addComponentListener(new ComponentAdapter() {
			@Override
			public void componentResized(ComponentEvent evt) {
				thisComponentResized(evt);
			}
		});
	}

	private void initGUI() {
		try {
			{
				scheduleSplitter = new JSplitPane();
				getContentPane().add(scheduleSplitter, BorderLayout.CENTER);
				scheduleSplitter.setPreferredSize(new java.awt.Dimension(1022,
						733));
				{
					scheduleToolTab = new JTabbedPane();
					scheduleSplitter.add(scheduleToolTab, JSplitPane.RIGHT);
					scheduleToolTab.setPreferredSize(new java.awt.Dimension(
							805, 731));
					{
						viewDay = new JPanel();
						BorderLayout viewDayLayout = new BorderLayout();
						scheduleToolTab.addTab("Day", null, viewDay, null);
						viewDay.setLayout(viewDayLayout);
						{
							jPanel2 = new JPanel();
							GroupLayout jPanel2Layout = new GroupLayout(
									jPanel2);
							viewDay.add(jPanel2, BorderLayout.NORTH);
							jPanel2.setBackground(new java.awt.Color(192,192,192));
							jPanel2.setPreferredSize(new java.awt.Dimension(
									839, 32));
							jPanel2.setLayout(jPanel2Layout);
							jPanel2.setBounds(0, 21, 840, 40);
							{
								jLabel7 = new JLabel();
								jLabel7.setText("View for:");
							}
							{
								ComboBoxModel jComboBox1Model = new DefaultComboBoxModel(
										new String[] { "Person", "Group" });
								jComboBox1 = new JComboBox();
								jComboBox1.setModel(jComboBox1Model);
								jComboBox1.setEnabled(false);
							}
							{
								dayLabel = new JLabel();
								dayLabel.setText("Date:");
							}
							jPanel2Layout.setHorizontalGroup(jPanel2Layout.createSequentialGroup()
								.addContainerGap()
								.addComponent(jLabel7, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
								.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
								.addComponent(jComboBox1, GroupLayout.PREFERRED_SIZE, 127, GroupLayout.PREFERRED_SIZE)
								.addGap(0, 39, Short.MAX_VALUE)
								.addComponent(dayLabel, GroupLayout.PREFERRED_SIZE, 41, GroupLayout.PREFERRED_SIZE)
								.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
								.addComponent(getDayPaneDateChooser(), GroupLayout.PREFERRED_SIZE, 129, GroupLayout.PREFERRED_SIZE)
								.addContainerGap(413, 413));
							jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup()
								.addGroup(jPanel2Layout.createSequentialGroup()
								    .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
								        .addComponent(jComboBox1, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
								        .addComponent(jLabel7, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
								        .addComponent(dayLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE))
								    .addContainerGap())
								.addGroup(GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
								    .addComponent(getDayPaneDateChooser(), GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE)
								    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
						}
						{
							schedulePaneDay = new SchedulePaneDay(model);
							viewDay.add(schedulePaneDay, BorderLayout.CENTER);
							schedulePaneDay.setBackground(new java.awt.Color(
									255, 0, 0));
							schedulePaneDay.setBounds(78, 55, 794, 332);
						}
						{
							jPanel3 = new JPanel();
							viewDay.add(jPanel3, BorderLayout.WEST);
							jPanel3.setBackground(new java.awt.Color(192,192,192));
							jPanel3.setPreferredSize(new java.awt.Dimension(45,
									670));
							jPanel3.add(getJLabel2());
							jPanel3.add(getJLabel3());
							jPanel3.add(getJLabel6());
							jPanel3.add(getJLabel9());
							jPanel3.add(getJLabel10());
							jPanel3.add(getJLabel12());
							jPanel3.add(getJLabel13());
							jPanel3.add(getJLabel14());
							jPanel3.add(getJLabel15());
							jPanel3.add(getJLabel16());
							jPanel3.add(getJLabel17());
							jPanel3.add(getJLabel18());
							jPanel3.add(getJLabel19());
							jPanel3.add(getJLabel20());
							jPanel3.add(getJLabel21());
							jPanel3.add(getJLabel22());
							jPanel3.add(getJLabel23());
							jPanel3.add(getJLabel24());
							jPanel3.add(getJLabel25());
							jPanel3.add(getJLabel26());
							jPanel3.add(getJLabel27());
							jPanel3.add(getJLabel28());
							jPanel3.add(getJLabel29());
							jPanel3.add(getJLabel30());
							jPanel3.add(getJLabel32());
							jPanel3.add(getJLabel33());
							jPanel3.add(getJLabel35());
							jPanel3.add(getJLabel31());
							jPanel3.add(getJLabel36());
							jPanel3.add(getJLabel37());
							jPanel3.add(getJLabel38());
							jPanel3.add(getJLabel39());
							jPanel3.add(getJLabel34());
							jPanel3.add(getJLabel40());
						}
					}
					{
						viewWeek = new JPanel();
						scheduleToolTab.addTab("Week", null, viewWeek, null);
						BorderLayout viewWeekLayout = new BorderLayout();
						viewWeek.setLayout(viewWeekLayout);
						{
							jPanel5 = new JPanel();
							GroupLayout jPanel5Layout = new GroupLayout((JComponent)jPanel5);
							viewWeek.add(jPanel5, BorderLayout.NORTH);
							jPanel5.setBackground(new java.awt.Color(192,192,192));
							jPanel5.setPreferredSize(new java.awt.Dimension(
									839, 32));
							jPanel5.setLayout(jPanel5Layout);
							jPanel5.setBounds(0, 21, 840, 40);
							{
								jLabel1 = new JLabel();
								jLabel1.setText("View for:");
							}
							{
								ComboBoxModel jComboBox4Model = new DefaultComboBoxModel(
										new String[] { "Person", "Group" });
								jComboBox4 = new JComboBox();
								jComboBox4.setModel(jComboBox4Model);
								jComboBox4.setEnabled(false);
							}
							{
								jLabel11 = new JLabel();
								jLabel11.setText("Start Date:");
							}
							jPanel5Layout.setHorizontalGroup(jPanel5Layout.createSequentialGroup()
								.addContainerGap()
								.addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
								.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
								.addComponent(jComboBox4, GroupLayout.PREFERRED_SIZE, 127, GroupLayout.PREFERRED_SIZE)
								.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 1, GroupLayout.PREFERRED_SIZE)
								.addComponent(jLabel11, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE)
								.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
								.addComponent(getWeekPaneDateChooser(), GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE)
								.addContainerGap(410, Short.MAX_VALUE));
							jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup()
								.addGroup(jPanel5Layout.createSequentialGroup()
								    .addGroup(jPanel5Layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
								        .addComponent(jComboBox4, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
								        .addComponent(jLabel1, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
								        .addComponent(jLabel11, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
								    .addContainerGap())
								.addGroup(GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup()
								    .addComponent(getWeekPaneDateChooser(), GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE)
								    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
						}
						{
							jPanel6 = new JPanel();
							viewWeek.add(jPanel6, BorderLayout.WEST);
							jPanel6.setBackground(new java.awt.Color(192,192,192));
							jPanel6.setPreferredSize(new java.awt.Dimension(45,
									670));
							jPanel6.add(getJLabel41());
							jPanel6.add(getJLabel42());
							jPanel6.add(getJLabel43());
							jPanel6.add(getJLabel44());
							jPanel6.add(getJLabel45());
							jPanel6.add(getJLabel46());
							jPanel6.add(getJLabel47());
							jPanel6.add(getJLabel48());
							jPanel6.add(getJLabel49());
							jPanel6.add(getJLabel50());
							jPanel6.add(getJLabel51());
							jPanel6.add(getJLabel52());
							jPanel6.add(getJLabel53());
							jPanel6.add(getJLabel54());
							jPanel6.add(getJLabel55());
							jPanel6.add(getJLabel56());
							jPanel6.add(getJLabel57());
							jPanel6.add(getJLabel58());
							jPanel6.add(getJLabel59());
							jPanel6.add(getJLabel60());
							jPanel6.add(getJLabel61());
							jPanel6.add(getJLabel62());
							jPanel6.add(getJLabel63());
							jPanel6.add(getJLabel64());
							jPanel6.add(getJLabel66());
							jPanel6.add(getJLabel65());
							jPanel6.add(getJLabel67());
							jPanel6.add(getJLabel68());
							jPanel6.add(getJLabel70());
							jPanel6.add(getJLabel69());
							jPanel6.add(getJLabel71());
						}
						{
							schedulePaneWeek = new SchedulePaneWeek(model);
							viewWeek.add(schedulePaneWeek, BorderLayout.CENTER);
							schedulePaneWeek.setBackground(new java.awt.Color(
									255, 0, 0));
							schedulePaneWeek.setBounds(78, 55, 794, 332);
						}
					}
					{
						viewMonth = new JPanel();
						scheduleToolTab.addTab("Month", null, viewMonth, null);
						BorderLayout viewMonthLayout = new BorderLayout();
						viewMonth.setPreferredSize(new java.awt.Dimension(1024,
								768));
						viewMonth.setLayout(viewMonthLayout);
						viewMonth.setSize(1024, 768);
						{
							jPanel7 = new JPanel();
							GroupLayout jPanel7Layout = new GroupLayout(
									jPanel7);
							viewMonth.add(jPanel7, BorderLayout.NORTH);
							jPanel7.setBackground(new java.awt.Color(128, 255,
									255));
							jPanel7.setPreferredSize(new java.awt.Dimension(
									838, 32));
							jPanel7.setLayout(jPanel7Layout);
							jPanel7.setBounds(0, 21, 840, 40);
							{
								jLabel8 = new JLabel();
								jLabel8.setText("View for:");
							}
							{
								ComboBoxModel showWhichPersonModel = new DefaultComboBoxModel(
										new String[] { "Item One", "Item Two" });
								showWhichPerson = new JComboBox();
								showWhichPerson.setModel(showWhichPersonModel);
							}
							{
								jLabel4 = new JLabel();
								jLabel4.setText("Month:");
							}
							{
								ComboBoxModel jComboBox2Model = new DefaultComboBoxModel(
										new String[] { "Item One", "Item Two" });
								jComboBox2 = new JComboBox();
								jComboBox2.setModel(jComboBox2Model);
							}
							{
								jLabel5 = new JLabel();
								jLabel5.setText("Year:");
							}
							{
								SpinnerListModel jSpinner3Model = new SpinnerListModel(
										new String[] { "Sun", "Mon", "Tue",
												"Wed", "Thu", "Fri", "Sat" });
								jSpinner3 = new JSpinner();
								jSpinner3.setModel(jSpinner3Model);
							}
							jPanel7Layout.setVerticalGroup(jPanel7Layout
									.createParallelGroup(
											GroupLayout.Alignment.BASELINE)
											.addComponent(jComboBox2,
													GroupLayout.Alignment.BASELINE,
													GroupLayout.PREFERRED_SIZE, 32,
													GroupLayout.PREFERRED_SIZE)
													.addComponent(jLabel4,
															GroupLayout.Alignment.BASELINE,
															GroupLayout.PREFERRED_SIZE,
															GroupLayout.PREFERRED_SIZE,
															GroupLayout.PREFERRED_SIZE)
															.addComponent(jSpinner3,
																	GroupLayout.Alignment.BASELINE,
																	GroupLayout.PREFERRED_SIZE, 32,
																	GroupLayout.PREFERRED_SIZE)
																	.addComponent(jLabel5,
																			GroupLayout.Alignment.BASELINE,
																			GroupLayout.PREFERRED_SIZE,
																			GroupLayout.PREFERRED_SIZE,
																			GroupLayout.PREFERRED_SIZE)
																			.addComponent(showWhichPerson,
																					GroupLayout.Alignment.BASELINE,
																					GroupLayout.PREFERRED_SIZE,
																					GroupLayout.PREFERRED_SIZE,
																					GroupLayout.PREFERRED_SIZE)
																					.addComponent(jLabel8,
																							GroupLayout.Alignment.BASELINE,
																							GroupLayout.PREFERRED_SIZE,
																							GroupLayout.PREFERRED_SIZE,
																							GroupLayout.PREFERRED_SIZE));
							jPanel7Layout
							.setHorizontalGroup(jPanel7Layout
									.createSequentialGroup()
									.addContainerGap()
									.addComponent(jLabel8,
											GroupLayout.PREFERRED_SIZE,
											55,
											GroupLayout.PREFERRED_SIZE)
											.addPreferredGap(
													LayoutStyle.ComponentPlacement.RELATED)
													.addComponent(showWhichPerson,
															GroupLayout.PREFERRED_SIZE,
															127,
															GroupLayout.PREFERRED_SIZE)
															.addGap(0, 323, Short.MAX_VALUE)
															.addComponent(jLabel4,
																	GroupLayout.PREFERRED_SIZE,
																	GroupLayout.PREFERRED_SIZE,
																	GroupLayout.PREFERRED_SIZE)
																	.addPreferredGap(
																			LayoutStyle.ComponentPlacement.RELATED,
																			0,
																			GroupLayout.PREFERRED_SIZE)
																			.addComponent(jComboBox2,
																					GroupLayout.PREFERRED_SIZE,
																					135,
																					GroupLayout.PREFERRED_SIZE)
																					.addPreferredGap(
																							LayoutStyle.ComponentPlacement.UNRELATED)
																							.addComponent(jLabel5,
																									GroupLayout.PREFERRED_SIZE,
																									31,
																									GroupLayout.PREFERRED_SIZE)
																									.addPreferredGap(
																											LayoutStyle.ComponentPlacement.RELATED)
																											.addComponent(jSpinner3,
																													GroupLayout.PREFERRED_SIZE,
																													65,
																													GroupLayout.PREFERRED_SIZE)
																													.addContainerGap());
						}
						{
							jPanel8 = new JPanel();
							viewMonth.add(jPanel8, BorderLayout.WEST);
							jPanel8.setBackground(new java.awt.Color(0, 128,
									255));
							jPanel8.setPreferredSize(new java.awt.Dimension(45,
									670));
						}
						{
							jPanel9 = new JPanel();
							viewMonth.add(jPanel9, BorderLayout.CENTER);
							jPanel9
							.setBackground(new java.awt.Color(255, 0, 0));
							jPanel9.setBounds(78, 55, 794, 332);
						}
					}
				}
				{
					jTabbedPane1 = new JTabbedPane();
					scheduleSplitter.add(jTabbedPane1, JSplitPane.LEFT);
					jTabbedPane1.setPreferredSize(new java.awt.Dimension(182,
							729));
					jTabbedPane1.setSize(300, 730);
					{
						groupPanel = new JPanel();
						jTabbedPane1.addTab("Groups/Persons", null, groupPanel,
								null);
						GroupLayout groupPanelLayout = new GroupLayout(
								groupPanel);
						groupPanel.setPreferredSize(new java.awt.Dimension(182,
								701));
						groupPanel.setLayout(groupPanelLayout);
						{
							groupPeoplePane = new JPanel();
							GroupLayout groupPeoplePaneLayout = new GroupLayout(
									groupPeoplePane);
							groupPeoplePane.setLayout(groupPeoplePaneLayout);
							{
								groupSplit = new JSplitPane();
								groupSplit
								.setOrientation(JSplitPane.VERTICAL_SPLIT);
								{
									peopleDisplayPane = new JPanel();
									GroupLayout groupPaneLayout = new GroupLayout(
											peopleDisplayPane);
									peopleDisplayPane
									.setLayout(groupPaneLayout);
									groupSplit.add(peopleDisplayPane,
											JSplitPane.RIGHT);
									{
										personList = new JList();
									}

									groupPaneLayout
									.setVerticalGroup(groupPaneLayout
											.createSequentialGroup()
											.addContainerGap()
											.addComponent(personList,
													0, 395,
													Short.MAX_VALUE)
													.addPreferredGap(
															LayoutStyle.ComponentPlacement.RELATED,
															12,
															GroupLayout.PREFERRED_SIZE));
									groupPaneLayout
									.setHorizontalGroup(groupPaneLayout
											.createParallelGroup()
											.addComponent(
													personList,
													GroupLayout.Alignment.LEADING,
													GroupLayout.PREFERRED_SIZE,
													174,
													GroupLayout.PREFERRED_SIZE));
								}
								{
									groupDisplayPane = new JPanel();
									GroupLayout peoplePaneLayout = new GroupLayout(
											groupDisplayPane);
									groupDisplayPane
									.setLayout(peoplePaneLayout);
									groupSplit.add(groupDisplayPane,
											JSplitPane.LEFT);
									groupDisplayPane
									.setPreferredSize(new java.awt.Dimension(
											152, 219));
									{
										ListModel jList1Model = new DefaultComboBoxModel(
												new String[] { "Item One",
														"Item Two" });
										groupList = new JList();
										groupList
										.addListSelectionListener(new ListSelectionListener() {
											public void valueChanged(
													ListSelectionEvent evt) {
												groupListValueChanged(evt);
											}
										});
										groupList.setModel(jList1Model);
									}
									peoplePaneLayout
									.setVerticalGroup(peoplePaneLayout
											.createSequentialGroup()
											.addComponent(groupList, 0,
													179,
													Short.MAX_VALUE)
													.addPreferredGap(
															LayoutStyle.ComponentPlacement.RELATED,
															12,
															GroupLayout.PREFERRED_SIZE));
									peoplePaneLayout
									.setHorizontalGroup(peoplePaneLayout
											.createParallelGroup()
											.addComponent(
													groupList,
													GroupLayout.Alignment.LEADING,
													0, 174,
													Short.MAX_VALUE));
								}
							}
							groupPeoplePaneLayout
							.setHorizontalGroup(groupPeoplePaneLayout
									.createSequentialGroup()
									.addComponent(groupSplit,
											GroupLayout.PREFERRED_SIZE,
											176,
											GroupLayout.PREFERRED_SIZE));
							groupPeoplePaneLayout
							.setVerticalGroup(groupPeoplePaneLayout
									.createSequentialGroup()
									.addComponent(groupSplit, 0, 693,
											Short.MAX_VALUE));
						}
						groupPanelLayout.setVerticalGroup(groupPanelLayout
								.createSequentialGroup().addContainerGap(
										GroupLayout.DEFAULT_SIZE,
										Short.MAX_VALUE).addComponent(
												groupPeoplePane,
												GroupLayout.PREFERRED_SIZE, 672,
												GroupLayout.PREFERRED_SIZE)
												.addPreferredGap(
														LayoutStyle.ComponentPlacement.RELATED,
														0, GroupLayout.PREFERRED_SIZE));
						groupPanelLayout.setHorizontalGroup(groupPanelLayout
								.createSequentialGroup().addComponent(
										groupPeoplePane, 0, 104,
										Short.MAX_VALUE).addContainerGap());
					}
				}
			}
			{
				jMenuBar1 = new JMenuBar();
				setJMenuBar(jMenuBar1);
				{
					jMenu3 = new JMenu();
					jMenuBar1.add(jMenu3);
					jMenu3.setText("File");
					{
						newFileMenuItem = new JMenu();
						jMenu3.add(newFileMenuItem);
						jMenu3.add(getLoadMenu());
						jMenu3.add(getSaveMenu());
						newFileMenuItem.setText("New");
						newFileMenuItem.add(getFileMenuAddEvent());
						newFileMenuItem.add(getFileMenuItemAddPerson());
						newFileMenuItem.add(getFileMenuItemAddGroup());
					}
					{
						jSeparator2 = new JSeparator();
						jMenu3.add(jSeparator2);
					}
					{
						exitMenuItem = new JMenuItem();
						jMenu3.add(exitMenuItem);
						exitMenuItem.setText("Exit");
						exitMenuItem.setAction(getExitApplicationAction());
					}
				}
				{
					jMenu4 = new JMenu();
					jMenuBar1.add(jMenu4);
					jMenu4.setText("Edit");
					{
						deleteMenu = new JMenu();
						jMenu4.add(deleteMenu);
						jMenu4.add(getEditMenu());
						jMenu4.add(getJMenu1());
						deleteMenu.setText("Delete");
						deleteMenu.add(getDeletePersonMenuItem());
						deleteMenu.add(getDeleteEventMenuItem());
						deleteMenu.add(getDeleteGroupMenuItem());
					}
				}
			}
			scheduleToolTab.setEnabledAt(2, false);
			//jTabbedPane1.setEnabledAt(1, false);
			pack();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void updateGroupList() {
		Group[] groups = new Group[0];
		ArrayList<JLabel> allGroups = new ArrayList<JLabel>();
		groups = model.getSchedule().getGroups().toArray(groups);
		for (int i = 0; i < groups.length; i++) {
			allGroups.add(new GroupWrapper(groups[i]));
		}

		ListModel list1Model = new DefaultComboBoxModel(allGroups.toArray());
		groupList.setModel(list1Model);
		groupList.setCellRenderer(new ModelCellRenderer());
	}

	public void updatePersonList(int id) {
		Person[] persons = new Person[0];
		ArrayList<JLabel> allPersons = new ArrayList<JLabel>();
		persons = model.getSchedule().getGroup(id).getPersons().toArray(persons);
		for (int i = 0; i < persons.length; i++) {
			allPersons.add(new PersonWrapper(persons[i]));
		}

		ListModel list2Model = new DefaultComboBoxModel(allPersons.toArray());
		personList.setModel(list2Model);
		personList.setCellRenderer(new ModelCellRenderer());
	}

	public void updatePersonList() {
		// peopleDisplayPane.removeAll();
		Person[] persons = new Person[0];
		ArrayList<JLabel> allPersons = new ArrayList<JLabel>();
		persons = model.getSchedule().getPersons().toArray(persons);
		for (int i = 0; i < persons.length; i++) {
			allPersons.add(new PersonWrapper(persons[i]));
		}

		ListModel list2Model = new DefaultComboBoxModel(allPersons.toArray());
		personList.setModel(list2Model);
		personList.setCellRenderer(new ModelCellRenderer());
	}

	public void updateSchedulePanes() {
		schedulePaneDay.addAllEvents();
		schedulePaneDay.validate();
		schedulePaneDay.repaint();
		schedulePaneWeek.addAllEvents();
		schedulePaneWeek.validate();
		schedulePaneWeek.repaint();
	}

	public int getSelectedGroup() {
		return ((GroupWrapper) groupList.getSelectedValue()).getId();
	}

	private AbstractAction getAddGroupAction() {
		if (AddGroupAction == null) {
			AddGroupAction = new AbstractAction("Add", null) {
				public void actionPerformed(ActionEvent evt) {
					newGroupDialog = new GroupDialog();
					newGroupDialog.setVisible(true);
				}
			};
		}
		return AddGroupAction;
	}

	private AbstractAction getDeleteGroupAction() {
		if (deleteGroupAction == null) {
			deleteGroupAction = new AbstractAction("Delete Group", null) {
				public void actionPerformed(ActionEvent evt) {
					DeleteGroupDialog temp = new DeleteGroupDialog(model);
					temp.setVisible(true);
				}
			};
		}
		return deleteGroupAction;
	}
	
	private AbstractAction getAddPersonAction() {
		if (addPersonAction == null) {
			addPersonAction = new AbstractAction("Add", null) {
				public void actionPerformed(ActionEvent evt) {
					newPersonDialog = new PersonDialog();
					newPersonDialog.setVisible(true);
				}
			};
		}
		return addPersonAction;
	}


	private AbstractAction getDeletePersonAction() {
		if (deletePersonAction == null) {
			deletePersonAction = new AbstractAction("Delete Person", null) {
				public void actionPerformed(ActionEvent evt) {
					DeletePersonDialog temp = new DeletePersonDialog(model);
					temp.setVisible(true);
				}
			};
		}
		return deletePersonAction;
	}

	private JMenuItem getFileMenuAddEvent() {
		if (fileMenuAddEvent == null) {
			fileMenuAddEvent = new JMenuItem();
			fileMenuAddEvent.setText("Event");
			fileMenuAddEvent.setAction(getAddNewEventByDialog());
		}
		return fileMenuAddEvent;
	}

	private JMenuItem getFileMenuItemAddPerson() {
		if (fileMenuItemAddPerson == null) {
			fileMenuItemAddPerson = new JMenuItem();
			fileMenuItemAddPerson.setAction(getAddPersonAction());
			fileMenuItemAddPerson.setText("Person");
		}
		return fileMenuItemAddPerson;
	}

	private JMenuItem getFileMenuItemAddGroup() {
		if (fileMenuItemAddGroup == null) {
			fileMenuItemAddGroup = new JMenuItem();
			fileMenuItemAddGroup.setAction(getAddGroupAction());
			fileMenuItemAddGroup.setText("Group");
		}
		return fileMenuItemAddGroup;
	}

	private AbstractAction getAddNewEventByDialog() {
		if (addNewEventByDialog == null) {
			addNewEventByDialog = new AbstractAction("Event", null) {
				public void actionPerformed(ActionEvent evt) {
					createNewEventDialog = new EventDialog();
					createNewEventDialog.setVisible(true);
				}
			};
		}
		return addNewEventByDialog;
	}

	private void groupListValueChanged(ListSelectionEvent evt) {
		int groupId = 0;
		if (groupList.getSelectedValue() != null) {
			groupId = (((GroupWrapper) groupList.getSelectedValue()).getId());
			if (groupList.getSelectedIndex() < 0) {
				groupList.setSelectedIndex(0);
			}
		}
		updatePersonList(groupId);
	}

	private JDateChooser getDayPaneDateChooser() {
		if (dayPaneDateChooser == null) {
			dayPaneDateChooser = new JDateChooser();
			dayPaneDateChooser.setDate(new Date());
			dayPaneDateChooser
			.addPropertyChangeListener(new PropertyChangeListener() {
				public void propertyChange(PropertyChangeEvent evt) {
					dayPaneDateChooserPropertyChange(evt);
				}
			});
		}
		return dayPaneDateChooser;
	}

	private JDateChooser getWeekPaneDateChooser() {
		if (weekPaneDateChooser == null) {
			weekPaneDateChooser = new JDateChooser();
			weekPaneDateChooser.setDate(new Date());
			weekPaneDateChooser
			.addPropertyChangeListener(new PropertyChangeListener() {
				public void propertyChange(PropertyChangeEvent evt) {
					weekPaneDateChooserPropertyChange(evt);
				}
			});
		}
		return weekPaneDateChooser;
	}

	private void weekPaneDateChooserPropertyChange(PropertyChangeEvent evt) {
		// System.out.println("weekPaneDateChooser.propertyChange, event="+evt);
		Calendar cal = Calendar.getInstance();
		JDateChooser dc = (JDateChooser) evt.getSource();
		cal.setTime(dc.getDate());
		cal.set(Calendar.HOUR_OF_DAY, 0);
		cal.set(Calendar.MINUTE, 0);
		schedulePaneWeek.setStartDate(cal.getTime());
		schedulePaneWeek.addAllEvents();
		schedulePaneWeek.validate();
	}

	private void dayPaneDateChooserPropertyChange(PropertyChangeEvent evt) {
		// System.out.println("dayPaneDateChooser.propertyChange, event="+evt);
		Calendar cal = Calendar.getInstance();
		JDateChooser dc = (JDateChooser) evt.getSource();
		cal.setTime(dc.getDate());
		cal.set(Calendar.HOUR_OF_DAY, 0);
		cal.set(Calendar.MINUTE, 0);
		schedulePaneDay.setStartDate(cal.getTime());
		schedulePaneDay.addAllEvents();
		schedulePaneDay.validate();
	}

	private JMenuItem getDeletePersonMenuItem() {
		if (deletePersonMenuItem == null) {
			deletePersonMenuItem = new JMenuItem();
			deletePersonMenuItem.setText("Delete Person");
			deletePersonMenuItem.setAction(getDeletePersonAction());
		}
		return deletePersonMenuItem;
	}

	private JMenuItem getDeleteEventMenuItem() {
		if (deleteEventMenuItem == null) {
			deleteEventMenuItem = new JMenuItem();
			deleteEventMenuItem.setText("Delete Event");
			deleteEventMenuItem.setAction(getDeleteEventAction());
		}
		return deleteEventMenuItem;
	}

	private JMenuItem getDeleteGroupMenuItem() {
		if (deleteGroupMenuItem == null) {
			deleteGroupMenuItem = new JMenuItem();
			deleteGroupMenuItem.setText("Delete Group");
			deleteGroupMenuItem.setAction(getDeleteGroupAction());
		}
		return deleteGroupMenuItem;
	}

	private AbstractAction getDeleteEventAction() {
		if (deleteEventAction == null) {
			deleteEventAction = new AbstractAction("Delete Event", null) {
				public void actionPerformed(ActionEvent evt) {
					DeleteEventDialog temp = new DeleteEventDialog(model);
					temp.setVisible(true);
				}
			};
		}
		return deleteEventAction;
	}

	private void thisComponentResized(ComponentEvent evt) {
		System.out.println("Mainwindow resized");
		this.updateSchedulePanes();
	}

	private JMenu getEditMenu() {
		if (editMenu == null) {
			editMenu = new JMenu();
			editMenu.setText("Edit");
			editMenu.add(getEditGroupMenuItem());
			editMenu.add(getEditEventMenuItem());
			editMenu.add(getEditPersonMenuItem());
		}
		return editMenu;
	}

	/*private JMenuItem getEditEventMenuItem() {
		if (editEventMenuItem == null) {
			editEventMenuItem = new JMenuItem();
			editEventMenuItem.setText("Edit Event");
			editEventMenuItem.setAction(editEventAction);
		}
		return editEventMenuItem;
	}*/
	private JMenuItem getEditEventMenuItem() {
		if (editEventMenuItem == null) {
			editEventMenuItem = new JMenuItem();
			editEventMenuItem.setText("Edit Event");
			editEventMenuItem.setAction(getEditEventAction());
		}
		return editEventMenuItem;
	}
	private JMenuItem getEditGroupMenuItem() {
		if (editGroupMenuItem == null) {
			editGroupMenuItem = new JMenuItem();
			editGroupMenuItem.setText("Edit Group");
			editGroupMenuItem.setAction(getEditGroupAction());
		}
		return editGroupMenuItem;
	}

	private JMenuItem getEditPersonMenuItem() {
		if (editPersonMenuItem == null) {
			editPersonMenuItem = new JMenuItem();
			editPersonMenuItem.setText("Edit Person");
			editPersonMenuItem.setAction(getEditPersonAction());
		}
		return editPersonMenuItem;
	}


	private AbstractAction getEditPersonAction() {
		if (editPersonAction == null) {
			editPersonAction = new AbstractAction("Edit Person", null) {
				public void actionPerformed(ActionEvent evt) {
					EditPersonDialog temp = new EditPersonDialog(model);
					temp.setVisible(true);
				}
			};
		}
		return editPersonAction;
	}

	private JMenu getJMenu1() {
		if(addMenu == null) {
			addMenu = new JMenu();
			addMenu.setText("Add");
			addMenu.add(getAddPersonToEventMenu());
			addMenu.add(getAddPersonToGroupMenuItem());
		}
		return addMenu;
	}

	private JMenuItem getAddPersonToEventMenu() {
		if(addPersonToEventMenu == null) {
			addPersonToEventMenu = new JMenuItem();
			addPersonToEventMenu.setText("Add person to event");
			addPersonToEventMenu.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent evt) {
					addPersonToEventMenuActionPerformed(evt);
				}
			});
		}
		return addPersonToEventMenu;
	}

	private void addPersonToEventMenuActionPerformed(ActionEvent evt) {
		AddPersonToEventDialog temp = new AddPersonToEventDialog(model);
		temp.setVisible(true);

	}

	private AbstractAction getEditGroupAction() {
		if(editGroupAction == null) {
			editGroupAction = new AbstractAction("Edit Group", null) {
				public void actionPerformed(ActionEvent evt) {
					EditGroupDialog temp = new EditGroupDialog(model);
					temp.setVisible(true);
				}
			};
		}
		return editGroupAction;
	}
	private AbstractAction getEditEventAction() {
		if(editEventAction == null) {
			editEventAction = new AbstractAction("Edit Event", null) {
				public void actionPerformed(ActionEvent evt) {
					EditEventDialog temp = new EditEventDialog(model);
					temp.setVisible(true);
				}
			};
		}
		return editEventAction;
	}

	private JMenuItem getAddPersonToGroupMenuItem() {
		if(addPersonToGroupMenuItem == null) {
			addPersonToGroupMenuItem = new JMenuItem();
			addPersonToGroupMenuItem.setText("Add person to group");
			addPersonToGroupMenuItem.setAction(getAddPersonToGroupAction());
		}
		return addPersonToGroupMenuItem;
	}

	private AbstractAction getAddPersonToGroupAction() {
		if(addPersonToGroupAction == null) {
			addPersonToGroupAction = new AbstractAction("Add person to group", null) {
				public void actionPerformed(ActionEvent evt) {
					AddPersonToGroupDialog temp =  new AddPersonToGroupDialog(model);
					temp.setVisible(true);
				}
			};
		}
		return addPersonToGroupAction;
	}

	private AbstractAction getExitApplicationAction() {
		if(exitApplicationAction == null) {
			exitApplicationAction = new AbstractAction("Exit", null) {
				public void actionPerformed(ActionEvent evt) {
					dispose();
				}
			};
		}
		return exitApplicationAction;
	}
	
	private JLabel getJLabel2() {
		if(jLabel2 == null) {
			jLabel2 = new JLabel();
			jLabel2.setText("00:00");
		}
		return jLabel2;
	}
	
	private JLabel getJLabel3() {
		if(jLabel3 == null) {
			jLabel3 = new JLabel();
			jLabel3.setText("          ");
		}
		return jLabel3;
	}
	
	private JLabel getJLabel6() {
		if(jLabel6 == null) {
			jLabel6 = new JLabel();
			jLabel6.setText("       ");
		}
		return jLabel6;
	}
	
	private JLabel getJLabel9() {
		if(jLabel9 == null) {
			jLabel9 = new JLabel();
			jLabel9.setText("     ");
		}
		return jLabel9;
	}
	
	private JLabel getJLabel10() {
		if(jLabel10 == null) {
			jLabel10 = new JLabel();
			jLabel10.setText("03:00");
		}
		return jLabel10;
	}
	
	private JLabel getJLabel12() {
		if(jLabel12 == null) {
			jLabel12 = new JLabel();
			jLabel12.setText("        ");
		}
		return jLabel12;
	}
	
	private JLabel getJLabel13() {
		if(jLabel13 == null) {
			jLabel13 = new JLabel();
			jLabel13.setText("      ");
		}
		return jLabel13;
	}
	
	private JLabel getJLabel14() {
		if(jLabel14 == null) {
			jLabel14 = new JLabel();
			jLabel14.setText("       ");
		}
		return jLabel14;
	}
	
	private JLabel getJLabel15() {
		if(jLabel15 == null) {
			jLabel15 = new JLabel();
			jLabel15.setText("06:00");
		}
		return jLabel15;
	}
	
	private JLabel getJLabel16() {
		if(jLabel16 == null) {
			jLabel16 = new JLabel();
			jLabel16.setText("      ");
		}
		return jLabel16;
	}
	
	private JLabel getJLabel17() {
		if(jLabel17 == null) {
			jLabel17 = new JLabel();
			jLabel17.setText("         ");
		}
		return jLabel17;
	}
	
	private JLabel getJLabel18() {
		if(jLabel18 == null) {
			jLabel18 = new JLabel();
			jLabel18.setText("      ");
		}
		return jLabel18;
	}
	
	private JLabel getJLabel19() {
		if(jLabel19 == null) {
			jLabel19 = new JLabel();
			jLabel19.setText("09:00");
		}
		return jLabel19;
	}
	
	private JLabel getJLabel20() {
		if(jLabel20 == null) {
			jLabel20 = new JLabel();
			jLabel20.setText("        ");
		}
		return jLabel20;
	}
	
	private JLabel getJLabel21() {
		if(jLabel21 == null) {
			jLabel21 = new JLabel();
			jLabel21.setText("       ");
		}
		return jLabel21;
	}
	
	private JLabel getJLabel22() {
		if(jLabel22 == null) {
			jLabel22 = new JLabel();
			jLabel22.setText("        ");
		}
		return jLabel22;
	}
	
	private JLabel getJLabel23() {
		if(jLabel23 == null) {
			jLabel23 = new JLabel();
			jLabel23.setText("12:00");
		}
		return jLabel23;
	}
	
	private JLabel getJLabel24() {
		if(jLabel24 == null) {
			jLabel24 = new JLabel();
			jLabel24.setText("       ");
		}
		return jLabel24;
	}
	
	private JLabel getJLabel25() {
		if(jLabel25 == null) {
			jLabel25 = new JLabel();
			jLabel25.setText("       ");
		}
		return jLabel25;
	}
	
	private JLabel getJLabel26() {
		if(jLabel26 == null) {
			jLabel26 = new JLabel();
			jLabel26.setText("          ");
		}
		return jLabel26;
	}
	
	private JLabel getJLabel27() {
		if(jLabel27 == null) {
			jLabel27 = new JLabel();
			jLabel27.setText("15:00");
		}
		return jLabel27;
	}
	
	private JLabel getJLabel28() {
		if(jLabel28 == null) {
			jLabel28 = new JLabel();
			jLabel28.setText("    ");
		}
		return jLabel28;
	}
	
	private JLabel getJLabel29() {
		if(jLabel29 == null) {
			jLabel29 = new JLabel();
			jLabel29.setText("     ");
		}
		return jLabel29;
	}
	
	private JLabel getJLabel30() {
		if(jLabel30 == null) {
			jLabel30 = new JLabel();
			jLabel30.setText("  ");
		}
		return jLabel30;
	}
	
	private JLabel getJLabel31() {
		if(jLabel31 == null) {
			jLabel31 = new JLabel();
			jLabel31.setText("18:00");
		}
		return jLabel31;
	}
	
	private JLabel getJLabel32() {
		if(jLabel32 == null) {
			jLabel32 = new JLabel();
			jLabel32.setText("     ");
		}
		return jLabel32;
	}
	
	private JLabel getJLabel33() {
		if(jLabel33 == null) {
			jLabel33 = new JLabel();
			jLabel33.setText("  ");
		}
		return jLabel33;
	}
	
	private JLabel getJLabel34() {
		if(jLabel34 == null) {
			jLabel34 = new JLabel();
			jLabel34.setText("21:00");
		}
		return jLabel34;
	}
	
	private JLabel getJLabel35() {
		if(jLabel35 == null) {
			jLabel35 = new JLabel();
			jLabel35.setText("       ");
		}
		return jLabel35;
	}
	
	private JLabel getJLabel36() {
		if(jLabel36 == null) {
			jLabel36 = new JLabel();
			jLabel36.setText("     ");
		}
		return jLabel36;
	}
	
	private JLabel getJLabel37() {
		if(jLabel37 == null) {
			jLabel37 = new JLabel();
			jLabel37.setText("     ");
		}
		return jLabel37;
	}
	
	private JLabel getJLabel38() {
		if(jLabel38 == null) {
			jLabel38 = new JLabel();
			jLabel38.setText("       ");
		}
		return jLabel38;
	}
	
	private JLabel getJLabel39() {
		if(jLabel39 == null) {
			jLabel39 = new JLabel();
			jLabel39.setText("       ");
		}
		return jLabel39;
	}
	
	private JLabel getJLabel40() {
		if(jLabel40 == null) {
			jLabel40 = new JLabel();
			jLabel40.setText("       ");
		}
		return jLabel40;
	}
	
	private JMenuItem getSaveMenu() {
		if(saveMenu == null) {
			saveMenu = new JMenuItem();
			saveMenu.setAction(ControllerFactory.getController(ControllerFactory.ControllerType.COMMIT_CHANGES));
			saveMenu.setText("Save");
		}
		return saveMenu;
	}
	
	private JMenuItem getLoadMenu() {
		if(loadMenu == null) {
			loadMenu = new JMenuItem();
			loadMenu.setAction(ControllerFactory.getController(ControllerFactory.ControllerType.CHECKOUT));
			loadMenu.setText("Load");
		}
		return loadMenu;
	}
	
	private JLabel getJLabel41() {
		if(jLabel41 == null) {
			jLabel41 = new JLabel();
			jLabel41.setText("00:00");
		}
		return jLabel41;
	}
	
	private JLabel getJLabel42() {
		if(jLabel42 == null) {
			jLabel42 = new JLabel();
			jLabel42.setText("          ");
		}
		return jLabel42;
	}
	
	private JLabel getJLabel43() {
		if(jLabel43 == null) {
			jLabel43 = new JLabel();
			jLabel43.setText("       ");
		}
		return jLabel43;
	}
	
	private JLabel getJLabel44() {
		if(jLabel44 == null) {
			jLabel44 = new JLabel();
			jLabel44.setText("     ");
		}
		return jLabel44;
	}
	
	private JLabel getJLabel45() {
		if(jLabel45 == null) {
			jLabel45 = new JLabel();
			jLabel45.setText("03:00");
		}
		return jLabel45;
	}
	
	private JLabel getJLabel46() {
		if(jLabel46 == null) {
			jLabel46 = new JLabel();
			jLabel46.setText("        ");
		}
		return jLabel46;
	}
	
	private JLabel getJLabel47() {
		if(jLabel47 == null) {
			jLabel47 = new JLabel();
			jLabel47.setText("      ");
		}
		return jLabel47;
	}
	
	private JLabel getJLabel48() {
		if(jLabel48 == null) {
			jLabel48 = new JLabel();
			jLabel48.setText("       ");
		}
		return jLabel48;
	}
	
	private JLabel getJLabel49() {
		if(jLabel49 == null) {
			jLabel49 = new JLabel();
			jLabel49.setText("06:00");
		}
		return jLabel49;
	}
	
	private JLabel getJLabel50() {
		if(jLabel50 == null) {
			jLabel50 = new JLabel();
			jLabel50.setText("      ");
		}
		return jLabel50;
	}
	
	private JLabel getJLabel51() {
		if(jLabel51 == null) {
			jLabel51 = new JLabel();
			jLabel51.setText("         ");
		}
		return jLabel51;
	}
	
	private JLabel getJLabel52() {
		if(jLabel52 == null) {
			jLabel52 = new JLabel();
			jLabel52.setText("      ");
		}
		return jLabel52;
	}
	
	private JLabel getJLabel53() {
		if(jLabel53 == null) {
			jLabel53 = new JLabel();
			jLabel53.setText("09:00");
		}
		return jLabel53;
	}
	
	private JLabel getJLabel54() {
		if(jLabel54 == null) {
			jLabel54 = new JLabel();
			jLabel54.setText("        ");
		}
		return jLabel54;
	}
	
	private JLabel getJLabel55() {
		if(jLabel55 == null) {
			jLabel55 = new JLabel();
			jLabel55.setText("       ");
		}
		return jLabel55;
	}
	
	private JLabel getJLabel56() {
		if(jLabel56 == null) {
			jLabel56 = new JLabel();
			jLabel56.setText("        ");
		}
		return jLabel56;
	}
	
	private JLabel getJLabel57() {
		if(jLabel57 == null) {
			jLabel57 = new JLabel();
			jLabel57.setText("12:00");
		}
		return jLabel57;
	}
	
	private JLabel getJLabel58() {
		if(jLabel58 == null) {
			jLabel58 = new JLabel();
			jLabel58.setText("       ");
		}
		return jLabel58;
	}
	
	private JLabel getJLabel59() {
		if(jLabel59 == null) {
			jLabel59 = new JLabel();
			jLabel59.setText("       ");
		}
		return jLabel59;
	}
	
	private JLabel getJLabel60() {
		if(jLabel60 == null) {
			jLabel60 = new JLabel();
			jLabel60.setText("          ");
		}
		return jLabel60;
	}
	
	private JLabel getJLabel61() {
		if(jLabel61 == null) {
			jLabel61 = new JLabel();
			jLabel61.setText("15:00");
		}
		return jLabel61;
	}
	
	private JLabel getJLabel62() {
		if(jLabel62 == null) {
			jLabel62 = new JLabel();
			jLabel62.setText("    ");
		}
		return jLabel62;
	}
	
	private JLabel getJLabel63() {
		if(jLabel63 == null) {
			jLabel63 = new JLabel();
			jLabel63.setText("     ");
		}
		return jLabel63;
	}
	
	private JLabel getJLabel64() {
		if(jLabel64 == null) {
			jLabel64 = new JLabel();
			jLabel64.setText("       ");
		}
		return jLabel64;
	}
	
	private JLabel getJLabel65() {
		if(jLabel65 == null) {
			jLabel65 = new JLabel();
			jLabel65.setText("18:00");
		}
		return jLabel65;
	}
	
	private JLabel getJLabel66() {
		if(jLabel66 == null) {
			jLabel66 = new JLabel();
			jLabel66.setText("     ");
		}
		return jLabel66;
	}
	
	private JLabel getJLabel67() {
		if(jLabel67 == null) {
			jLabel67 = new JLabel();
			jLabel67.setText("       ");
		}
		return jLabel67;
	}
	
	private JLabel getJLabel68() {
		if(jLabel68 == null) {
			jLabel68 = new JLabel();
			jLabel68.setText("       ");
		}
		return jLabel68;
	}
	
	private JLabel getJLabel69() {
		if(jLabel69 == null) {
			jLabel69 = new JLabel();
			jLabel69.setText("21:00");
		}
		return jLabel69;
	}
	
	private JLabel getJLabel70() {
		if(jLabel70 == null) {
			jLabel70 = new JLabel();
			jLabel70.setText("       ");
		}
		return jLabel70;
	}
	
	private JLabel getJLabel71() {
		if(jLabel71 == null) {
			jLabel71 = new JLabel();
			jLabel71.setText("       ");
		}
		return jLabel71;
	}

}
